using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace Pixysoft.BarCode
{
    public class BarCoder
    {
        private static BarCoder instance;
        public static BarCoder Instance
        {
            get
            {
                lock (typeof(BarCoder))
                {
                    if (instance == null)
                        instance = new BarCoder();
                    return instance;
                }
            }
        }

        public string GetBarCode(BarCodeType type, string value)
        {
            switch (type)
            {
                case BarCodeType.Interleaved2of5:
                    return Interleaved2of5.Instance.GetBarCode(value);
                case BarCodeType.Code128:
                    return Code128.Instance.GetBarCode(value);
                case BarCodeType.Code128A:
                    return Code128All.Instance.GetCode128A(value);
                case BarCodeType.Code128B:
                    return Code128All.Instance.GetCode128B(value);
                case BarCodeType.Code128C:
                    return Code128All.Instance.GetCode128C(value);
                case BarCodeType.Codabar:
                    return Codabar.Instance.GetBarCode(value);
                case BarCodeType.Code11:
                    return Code11.Instance.GetBarCode(value);
                case BarCodeType.Code39:
                    return Code39.Instance.GetBarCode(value);
                case BarCodeType.Code93:
                    return Code93.Instance.GetBarCode(value);

                case BarCodeType.EAN128:
                    return Code128All.Instance.GetEAN128(value);
                case BarCodeType.EAN13:
                    return EAN13.Instance.GetBarCode(value);
                case BarCodeType.EAN8:
                    return EAN8.Instance.GetBarCode(value);
                case BarCodeType.ISBN:
                    return ISBN.Instance.GetBarCode(value);
                case BarCodeType.JAN13:
                    return JAN13.Instance.GetBarCode(value);
                case BarCodeType.ITF14:
                    return ITF14.Instance.GetBarCode(value);
                case BarCodeType.MSI:
                    return MSI.Instance.GetBarCode(value);
                case BarCodeType.Postnet:
                    return Postnet.Instance.GetBarCode(value);
                case BarCodeType.Standard2of5:
                    return Standard2of5.Instance.GetBarCode(value);
                case BarCodeType.UPCA:
                    return UPCA.Instance.GetBarCode(value);
                case BarCodeType.UPCE:
                    return UPCE.Instance.GetBarCode(value);
                case BarCodeType.UPCSupplement2:
                    return UPCSupplement2.Instance.GetBarCode(value);
                case BarCodeType.UPCSupplement5:
                    return UPCSupplement5.Instance.GetBarCode(value);
                default:
                    return "0";
            }
        }

        private void test()
        {
            Console.Write(GetBarCode(BarCodeType.Interleaved2of5, "AMWH20908001"));
        }
    }
}
